<docs>
  ## my-bread 组件，通用头部组件
  ## props
  * type <index|common> 标题类型
  * title 主标题
  * titleSub 副标题
  * isToHome 是否backto 首页
</docs>
<template>
  <div class="header" :class="type">
    <span class="arrow" @click="back_btn"></span>
    <h3 class="title"> {{title}}</h3>
  </div>
</template>
<script>
export default {
  name: "my-bread",
  props: {
    type: {
      type: String,
      default: "",
    },
    title: {
      type: String,
      default: "",
    },
    titleSub: {
      type: String,
    },
    isToHome: {
      type: String,
      default: "",
    },
  },
  methods: {
    // 按钮点击
    back_btn() {
      if (this.isToHome) {
        this.$router.push({ path: "/home" });
        // this.$router.push({ path: "/test/type", name: "index" });
      } else {
        this.$router.go(-1);
      }
    },
  },
};
</script>

